{template header.html}

<script type="text/javascript">
    function reload_code() {
        document.getElementById('code').src = '{function.url("api/access/checkcode", array("width"=>80, "height"=>28))}&' + Math.random();
    }
    function usernameBlur() {
        var username = document.getElementById("inputUsername");
        var prompt = document.getElementById("username_prompt");
        prompt.innerHTML = "";
        if (username.value == "") {
            prompt.innerHTML = "请输入您的登陆账号";
            return false;
        }
        if (/^[a-zA-Z0-9_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+$/.test(username.value) == false) {
            prompt.innerHTML = "登陆账号格式不正确，请重新输入";
            return false;
        }
    }
    function pwdBlur() {
        var pwd = document.getElementById("inputPwd");
        var prompt = document.getElementById("pwd_prompt");
        prompt.innerHTML = "";
        var reg = /^[a-zA-Z0-9]{6,20}$/;
        if (pwd.value == "") {
            prompt.innerHTML = "请输入您的登陆密码";
            return false;
        }
        if (reg.test(pwd.value) == false) {
            prompt.innerHTML = "密码格式错误，请用大小写英文字母、数字，长度6-20个字符";
            return false;
        }
        return true;
    }
</script>

<form class="form form-horizontal" method="post" action="">
    <input type="hidden" value="{$backurl}" name="data[back]" />
    <div class="form-group form-inline">
        <label class="col-sm-2 control-label" for="inputUsername"><font color="red">*</font>登录会员：</label>
        <div class="col-sm-10">
            <input class="form-control" type="text" name="data[username]" id="inputUsername" placeholder="登陆账号" onblur="usernameBlur()" />
            <span id="username_prompt" class="tips_info"></span>
        </div>
    </div>
    <div class="form-group form-inline">
        <label class="col-sm-2 control-label" for="inputPwd"><font color="red">*</font>密码：</label>
        <div class="col-sm-10">
            <input class="form-control" type="password" name="data[password]" id="inputPwd" placeholder="账号密码" onblur="pwdBlur()" />
            <span id="pwd_prompt" class="tips_info"></span>
        </div>
    </div>
{if $config['MEMBER_LOGINCODE']}
    <div class="form-group form-inline">
        <label class="col-sm-2 control-label" for="inputCode"><font color="red">*</font>验证码：</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="code" id="inputCode" style="width:100px" placeholder="验证码" autocomplete="off" />
            <img id="code" title="看不清楚？换一张" align="absmiddle" onclick="reload_code();" src="{function.url('api/access/checkcode', array('width'=>80, 'height'=>28))}"  style="cursor:pointer; margin-top:-3px;" />
        </div>
    </div>
{/if}
    <div class="form-group form-inline">
        <div class="col-sm-2 control-label"></div>
        <div class="col-sm-10">
            <button type="submit" name="submit" class="btn btn-default">登录</button>
            <span style="padding-left:20px">
                <a href="#" onclick="return false">忘记密码？</a>
            </span>
        </div>
    </div>
</form>

{template footer.html}
